This description relates to determination of key bit positions in Gray codes.
Gray codes are useful in information and communication systems. In one example, a sequence of N binary Gray codes are used to represent a sequence of N binary numbers according to a one-to-one mapping relationship, N being an integer. FIG. 1 shows an example of a sequence of Gray codes that maps to a sequence of binary numbers 0000 to 1111. Adjacent binary numbers n and n+1 (or n and n−1) are represented by Gray codes that differ by a single digit. A Gray code can be generated by using exclusive-OR operations on bit values of a corresponding binary number. For example, for a 12-bit binary number expressed as b=(b11,b10,b9,b8,b7,b6,b5,b4,b3,b2, b1, b0), the corresponding 12-bit Gray code expressed as    g=(g11,g10,g9,g8,g7,g6,g5,g4,g3,g2,g1,g0) can be determined as follows:g11=b11gm=bm⊕bm+1, for m=0, 1, 2, . . . , 10.The most significant bit of a gray code (e.g., g11) is the same as the most significant bit (e.g., b11) of the corresponding binary number. Each of the other bits (e.g., gm) of the Gray code can be calculated from the exclusive-OR value of the corresponding bit (e.g., bm) in the binary number and the bit (e.g., bm+1) that is one digit higher than the corresponding bit.
A binary number b can be decoded from a corresponding Gray code g by using exclusive-OR operations. In the example above, given the Gray code g, the corresponding binary number b can be determined as follows:b11=g11bm=gm⊕bm+1=gm⊕gm+1⊕ . . . ⊕g11, for m=0, 1, 2, . . . , 10.The most significant bit (e.g., b11) of the binary number is the same as the most significant bit (e.g., g11) of the corresponding Gray code. Each of the other bits (e.g., bm) of the binary number is calculated from the exclusive-OR value of its corresponding bit (e.g., gm) in the Gray code and the bit (e.g., bm+1) that is one digit higher in the binary number. The mth bit of the binary number (other than the most significant bit) can also be calculated as the exclusive-OR value of all bits of the Gray code having bit positions equal to or higher than m.